define(
    function(require) {
        var BaseFormAction = require('common/FormAction');

        var $ = require('jquery');
        var u = require('underscore');

        function FormAction() {
            BaseFormAction.apply(this, arguments);
        }

        FormAction.prototype.modelType = require('./FormModel');

        FormAction.prototype.viewType = require('./FormView');

        FormAction.prototype.group = 'shoppingCoupon';

        FormAction.prototype.initBehavior = function() {
            BaseFormAction.prototype.initBehavior.apply(this, arguments);

            var imageList = this.view.get('products-preview');
            this.view.on(
                'products-upload',
                function (e) {
                    var serverData = e.data.data;;
                    if (u.isObject(serverData) && !u.isEmpty(serverData)) {
                        imageList.addItem({pic: serverData.url});
                    }
                }
            );
        };

        require('er/util').inherits(FormAction, BaseFormAction);

        return FormAction;
    }
);
